﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.Configuration;
using System.Configuration;

namespace ExtenDev.Web.Management
{
    public class ResourceManager
    {
        private ResourceManager()
        {

        }

        public void RenderResources(Control container)
        {
            
        }

        private static readonly object s_currentContextKey = new object();
        private static readonly ResourceConfigurationSection s_configuration;

        public static ResourceConfigurationSection Configuration { get { return s_configuration; } }

        static ResourceManager()
        {
            s_configuration = WebConfigurationManager.GetSection("ResourceConfiguration") as ResourceConfigurationSection;
            if (s_configuration == null)
            {
                throw new ConfigurationException("Configuration Section \"ResourceConfigration\" was not found!");
            }
        }

        public static ResourceManager Current
        {
            get
            {
                ResourceManager ret = HttpContext.Current.Items[s_currentContextKey] as ResourceManager;
                if (ret == null)
                {
                    ret = new ResourceManager();
                    HttpContext.Current.Items[s_currentContextKey] = ret;
                }

                return ret;
            }
        }

    }
}
